﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using GNF.GNFService.GNFClient;
using System.Xml.Linq;
using System.Xml;

namespace GNF.GNFService.TestClinet
{
    class Program
    {
        static void Main(string[] args)
        {
            //GNFServiceClient client = new GNFServiceClient();
            //if (Connect(client))
            //{
            //    Console.WriteLine("Opened Connection !");
            //    System.Threading.Thread.Sleep(50000);
            //}
            //else
            //{
            //    Console.WriteLine("could not Open Connection !");
            //}

            //client.Close();



            //XDocument s = new XDocument();
            //XmlWriter d = new XmlWriter
            XElement elem = new XElement("GPSLogs");
            elem.Save("humf.xml");//, SaveOptions.None);
            XElement elem2 = new XElement("second", new XAttribute("sec", 5));
            //elem2.Save("humf.xml", SaveOptions.None);
            elem = XElement.Load("humf.xml");
            elem.Add(elem2);
            elem.Save("humf.xml", SaveOptions.None);

            elem = XElement.Load("humf.xml");
            elem.Add(new XElement("humg",new XAttribute("sdfsd","Sdfsd")));
            elem.Save("humf.xml", SaveOptions.None);
        }

        

        public static bool Connect(GNFServiceClient c)
        {
            for (int i = 0; i < 10; i++)
            {
                if (c.Connect() == true)
                {
                    return true;
                }
                System.Threading.Thread.Sleep(50);
            }

            return false;
        }
    }
}
